﻿using System.Web;
using System.Web.Mvc;

namespace Mvc3Demo.Core
{
    public class CustomAuthorizeAttributeBase : AuthorizeAttribute
    {
        protected ControllerBase CurrentController = null;

        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            CurrentController = filterContext.Controller as ControllerBase;

            base.OnAuthorization(filterContext);

            if (filterContext.Result is HttpUnauthorizedResult)
            {
                ;
            }

        }
    }


    public class AuthorizeCustomerAccessAttribute : CustomAuthorizeAttributeBase
    {
        public string ParameterName { get; set; }

        public AuthorizeCustomerAccessAttribute(string parameterName)
        {
            ParameterName = parameterName;
        }

        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            if (CurrentController != null)
            {

            }

            return false;
        }
    }
}